When a computer program does an input operation, in which direction does the data flow?
From an outside device into the program.
Input and output are so common that an abbreviation has been created for them: IO (pronounced eye-oh.) IO operations are very complicated, both at the software level and at the electronic level. Part of the problem is that the way in which data is organized outside the computer is different from the way it is organized inside the computer.
There are no standard statements in the Java language for doing input or output. All input and output is done by using methods that are part of a package. A package is a collection of classes which may be used with other programs. For now, think of a package as a tool box and the classes within it as tools. Several IO packages are available. Usually a programmer picks just one of them, whichever contains the classes needed for the job. These notes use the java.io package, which is the IO package used most often.
It may seem odd to you that Java itself does not have IO built into it. The reason for this is that there are very many types of IO, and a language that has all of them built in would be large and cumbersome. A professional language such as Java (or C or C++ or any of several others) allows the programmer to pick the right IO package for the job.
Note: As mentioned, some text books use their own IO package based on java.io. Those methods will be somewhat different from those described here, but the ideas are the same.